<?php
/**
 * Baseollect.php
 *
 * PHP Version 5.6
 *
 * @category PHP
 * @package  Telegram\Dispatcher
 * @author   ctwj <908504609@qq.com>
 * @license  MIT https://mit-license.org/
 * @link     MIT https://mit-license.org/
 * @date     2018-05-13 22:56:47
 * @modifyby ctwj
 */

namespace Telegram\Dispatcher;

use Telegram\Exception\DispatcherException;

/**
 * Collect Base class
 *
 * @category PHP
 * @package  Telegram\Dispatcher
 * @author   ctwj <908504609@qq.com>
 * @license  MIT https://mit-license.org/
 * @link     MIT https://mit-license.org/
 */
class DispatcherFactory
{
    /**
     * 派发器工厂
     *
     * @param [string] $type 采集器类型
     *
     * @return Telegram\Collector\BaseDispatcher
     */
    public static function getInstance($type)
    {
        if ($type == 'telegram') {
            return new TelegramDispatcher();
        }
        getService('logger')->error('Invalid Collector Type', ['type' => $type]);
        throw new DispatcherException($type);
    }
}
